home *** CD-ROM | disk | FTP | other *** search
- Subject: Gem List
- Subject: Re: A better objc_edit()
- Date: Wed, 27 Jul 94 20:59 EST
- From: "Daniel J. Hollis" <0006795560@mcimail.com>
- To: ems <gem-list@world.std.com>
- Subject: Gem List
- Message-Id: <81940728015918/0006795560PK1EM@mcimail.com>
- Precedence: bulk
-
- Subject: Re: A better objc_edit()
-
- Someone (Who the HELL is this?!):
- ---------------------------------
- > Bravo, Bravo! Let's get down to some useful business.
-
- That's what I've been trying to do, but somehow, everyone got sidetracked.
-
- > What I need to know is how to find out the owner of a window with normal
- > TOS.
-
- With normal TOS, there is no way to find out which window belongs to what.
- You would have to keep a running tab in memory of which windows are open
- that belong to you. To do so:
-
- typedef struct window_owners
- {
- int handle;
- int owner;
- } WOWNERS;
-
- WOWNERS owned_winds[20]; /* Some TOS versions allow more than 7 winds */
-
- GLOBAL int WOpenWindow( ... )
- {
- /* Open your window */
- owned_winds[window_handle].handle = window_handle;
- owned_winds[window_handle].owner = Application_ID;
- }
-
- GLOBAL int WCloseWindow( ... )
- {
- /* Close and delete your window if linked to a list */
- owned_winds[window_handle].handle = 0;
- owned_winds[window_handle].owner = 0;
- }
-
- GLOBAL WGetOwner(int handle)
- {
- if ((handle != 0) && (owned_winds[handle].owner == Application_ID))
- return TRUE;
- else
- return FALSE;
- }
-
- Hope that helps a bit. This is the same type of code I have put into XAES,
- and it helps, especially when you work with your program as an accessory,
- or if you run it with Geneva or MultiTOS. Window ownership routines are a
- very good idea, and they should be standard. They are *VERY* easy to
- implement.
-
- Also, keep in mind that if you make your own wind_get and wind_set, then you
- can trap WF_OWNER [value = 20] and return the owner. :-)
-
- > It's not busy-waiting at all... event_multi will pass mouse events to my
- > application when MCTRL is set, otherwise, the OS just sits there.
-
- I don't quite think you understand how event_multi handles the mouse. If
- you move the mouse and you don't have a timer set, you will never get a
- mouse movement message, as they are always being returned. You could also
- wait for mouse button 0 and mouse state 0, but it's the same effect.
-
- > And besides, who cares about busy-waiting when you're not multitasking?
-
- DON'T get us started in this discussion again.
-
- > You can't make a distinction with normal TOS. You only get WF_TOPPED
- > messages. What I'm trying to do is simulate WF_BEVENT when I don't have
- > a multitasking OS.
-
- But I'm telling you, IT'S EASY! Just *try* the methods I've discussed. If
- you can't figure it out after that, then there's not much that I can help
- you with. Quit TALKING and actually *try* doing some of the things I've
- mentioned. You will not regret it.
-
- There doesn't seem to be WF_OWNER under normal TOS, and getting a
- window's handle doesn't give me the application's name, does it?
-
- > I just want example code I can use to make sure that mine doesn't miss
- > something. I want a form_button replacement that will work on a
- > background window, using the rectangle list of the window.
-
- To make sure it doesn't miss anything, make sure that you use:
-
- object_state |= SELECTED; /* Turn on selected bit */
- object_state &= ~SELECTED; /* Turn off selected bit */
-
- If you use those methods, or use "bitchg" routines (available on a.a.u.e) you
- can do it easily.
-
- > Oh, I don't even need that. If some exotic key were to be pressed, I
- > could just pass something DIFFERENT to form_keybd.
-
- Or you could just bypass form_keybd altogether.
-
- > For example, when you click the first time on an edit field, it acts
- > normal, but the second time, it will move the insertion point to where
- > you clicked by repeatedly sending arrow keys to form_keybd.
-
- That doesn't really have anything to do with form_keybd. That has to do with
- the repositioning of the cursor by using objc_edit (on) and objc_edit (off)
- to reposition the object, keeping in mind that you have to set a NULL
- character in front of the character where you wish to position the cursor.
- Once you do that, turn the cursor on. You will have the cursor repositioned.
- VOILA! :-)
-
- ]> Are the icons on the desktop part of a desktop form? If so, how do
- ]> programs get away with replacing the the background without removing the
- ]> desktop's object tree?
-
- > You didn't answer my question.
-
- Yes, ICONS are the part of the desktop form. It all depends on the form that
- you put on the desktop with WF_NEWDESK. What do you mean by the second
- question? When you move a window, it automatically redraws the desktop
- form, regardless of what's on it.
-
- -- Ken Hollis (Bitgate Software)
-
-